Skip to content

fix(consensus): validate block retrieval responses - #798

Closed
Lchangliang wants to merge 1 commit into
mainfrom
codex/audit-954-block-retrieval
Closed

Lchangliang wants to merge 1 commit into
mainfrom
codex/audit-954-block-retrieval

Conversation

@Lchangliang

Copy link
Copy Markdown
Contributor

Summary

  • reject successful block-retrieval responses that carry an empty block batch
  • validate zero-block-id epoch retrieval responses instead of skipping response.verify()
  • restore retrieved LedgerInfo signature / epoch checks while allowing the known epoch-change suffix block-number mismatch
  • return errors instead of panicking on malformed retrieval batches or block/QC mismatches during catch-up

Why

gravity-sdk#793 temporarily disabled retrieved LedgerInfo verification to avoid rejecting valid epoch-change suffix responses. That also removed the signature check and left malformed successful responses able to reach expect / assert sites in catch-up. This PR keeps the epoch-boundary compatibility while restoring the network-facing validation and making the consumer path fail with errors instead of panics.

Tests

  • cargo +nightly fmt --all -- --check
  • RUSTFLAGS="--cfg tokio_unstable -D warnings" cargo check -p "path+file:///Users/lightman/repos/gravity-sdk/aptos-core/consensus#aptos-consensus@0.1.0" --lib
  • RUSTFLAGS="--cfg tokio_unstable" cargo test -p "path+file:///Users/lightman/repos/gravity-sdk/aptos-core/consensus/consensus-types#aptos-consensus-types@0.1.0" verify_rejects_empty_successful_response
  • git diff --cached --check

Audit coverage

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open 45 days with no activity. Remove the stale label, comment or push a commit - otherwise this will be closed in 15 days.

@github-actions github-actions Bot added the Stale label Sep 12, 2026
@github-actions github-actions Bot closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant